<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:f="http://java.sun.com/jsf/core">
    <h:body>
		<ui:composition template="./templates/framework.xhtml">
			<ui:param name="searchHeader" value="true" />
			<ui:param name="noContentMargin" value="true" />
			<ui:define name="content">
				<ui:fragment rendered="#{empty listEntriesBean.items}">
					<ui:fragment rendered="#{empty listEntriesBean.searchKeyword}">
						<div style="text-align:center"><h:outputText value="#{i18n['list.emptyText']}" /> <a href="add.xhtml"><h:outputText value="#{i18n['list.emptyLink']}" /></a></div>
					</ui:fragment>
					<ui:fragment rendered="#{not empty listEntriesBean.searchKeyword}">
						<div style="text-align:center"><h:outputText value="#{i18n['list.searchEmpty']}" /></div>
					</ui:fragment>
				</ui:fragment>
				<script type="text/javascript">
					<ui:fragment rendered="#{listEntriesBean.renderGroups}">
						var isRenderItemGroups = true;
					</ui:fragment>
					<ui:fragment rendered="#{not listEntriesBean.renderGroups}">
						var isRenderItemGroups = false;
					</ui:fragment>
				</script>
				<div id="copyHint"><h:outputText value="#{i18n['list.copy']}" /> (<span class="timer">0</span>)</div>
				<h:form styleClass="passwordListForm">
					<ui:fragment rendered="#{not empty listEntriesBean.items}">
						<p id="decryptingHint">
							<img src="images/indicator.gif" />
							<h:outputText value="#{i18n['list.decode']}" />
						</p>
					</ui:fragment>
					<h:dataTable value="#{listEntriesBean.items}" var="item" styleClass="table passwordList" rendered="#{not empty listEntriesBean.items}" style="display:none" columnClasses="titleColumn,usernameColumn,passwordColumn,urlColumn,deleteColumn">
						<h:column>
							<div class="groupTitle"><h:outputText value="#{item.group.title}" /></div>
							<div class="itemId #{listEntriesBean.highlightId == item.exposableId ? 'highlight' : ''}"><h:outputText value="#{item.exposableId}" /></div>
							<h:outputLink value="#" styleClass="favorLink #{item.favored ? 'active' : ''} #{sessionBean.getKeeBookAccess('READ_WRITE') ? 'canChange' : ''}"></h:outputLink>
							<h:outputLink styleClass="titleLink" value="edit.xhtml?id=#{item.exposableId}" title="#{i18n['list.edit']}">
								<h:outputText value="#{item.title}" />
							</h:outputLink>
						</h:column>
						<h:column>
							<div class="usernameLink"><h:outputText value="#{item.username}" /></div>
						</h:column>
						<h:column>
							<h:outputText value="#{item.password}" styleClass="passwordContainer" />
							<h:outputText value="" styleClass="passwordLink" />
						</h:column>
						<h:column>
							<ui:fragment rendered="#{not empty item.url}">
								<h:outputLink value="#{item.url}" target="_blank" styleClass="urlLink"></h:outputLink>
							</ui:fragment>
						</h:column>
						<h:column>
							<ui:fragment rendered="#{sessionBean.getKeeBookAccess('READ_WRITE')}">
								<h:outputLink value="./index.xhtml?delete=#{item.exposableId}" onclick="return confirm('#{i18n['list.deleteConfirm']}')" styleClass="deleteLink"></h:outputLink>
							</ui:fragment>
						</h:column>
					</h:dataTable>
				</h:form>
			</ui:define>
		</ui:composition>
    </h:body>
</html>